<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Notification extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->checkAdmin($this->session->userdata('admin_id'));
        $this->checkPermission($this->session->userdata('level'), array(1));
        $this->data['controller'] = 'notification';         
        $this->load->model('Mindex');
        $this->load->model('Mstatics');
    }
    
   
    public function index()
    {
        
        $this->data['id_active'] = $this->getParamUri(2,3);
        $this->load->library('pagination');
        $config['per_page'] = 10;
        $this->data['page'] = $this->getParamUri(2,3);
        $data = $this->Mindex->getNotificationDB($config['per_page'],(($this->getParamUri(2,3) - 1) * $config['per_page'] > 0 ? ($this->getParamUri(2,3) - 1) * $config['per_page'] : 0),$this->session->userdata('admin_id'));
        $config['base_url'] = base_url($this->uri->segment(1).'/');//$this->uri->segment(2).'/');
        $config['total_rows'] = $data['count'];
        $config['uri_segment'] = 2;
        $config['uri_segment_page'] = $this->getParamUri(2,3);
        $config['suffix'] = '.html';
        $this->pagination->initialize($config);
 
        $this->data['pageg'] = $this->data['page'] - 1 > 0 ? $this->data['page'] - 1 : 0;
        $this->data['data'] = $data['data'];
        
        $this->data['action'] = 'index';
        $this->load->view('temp/layout', $this->data);
    }
    
    
    public function rnotification()
    {
        $id = $this->getParamInt('id');
        
        $this->data['data'] = $this->Mindex->getdetailNotification($id, $this->session->userdata('admin_id'));
        
        $this->data['action'] = 'rnotification';
        $this->load->view('temp/layout', $this->data);
    }
    
    
}
